/*
Sam Snyder
CS362
Assignment 3 part 1,3
unittest3.c

(20 points) Write unit tests for four functions (not card implementations or cardEffect) in dominion.c. Check these tests in as unittest1.c, unittest2.c, unittest3.c, and unittest4.c. (for example, you can create a test for updateCoins() method)


This is a test of the function fullDeckCount
*-----------------------------------------------------------------------
 * Include the following lines in your makefile:
 *
 * unittest3: unittest3.c dominion.o rngs.o
 *      gcc -o unittest3 -g  unittest3.c dominion.o rngs.o $(CFLAGS)
 * -----------------------------------------------------------------------
 */

#include <math.h>
#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"
#include <stdlib.h>
#include <time.h>

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

 int main() {
 	int i,j,r, handCardCount, deckCardCount, discardCardCount;
 	struct gameState G;
 	int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};
 	r = initializeGame(MAX_PLAYERS, k, 1, &G);

 	//give first player hand 	 of card type -1
 	handCardCount = 3;//rand() % G.handCount[0];
 	for (i=0; i < G.handCount[0];i++){
 		G.hand[0][i] = 0;
 	}
 	for (i=0; i < handCardCount ;i++){
 		G.hand[0][i] = 1;
 	}	

 	//give deck random # card type -1
 	 deckCardCount = 8;//rand()% G.deckCount[0];
 	 for (i=0; i < G.deckCount[0];i++){
 	 	G.deck[0][i] = 0;
 	 }
 	 for (i=0; i< deckCardCount;i++){
 	 	G.deck[0][i] = 1;
 	 }

 	//give discard random # card type -1
 	//first give him some discards
 	G.discardCount[0] = 3;//rand()% 10;
 	for (i=0; i < G.discardCount[0];i++){
 		G.discard[0][i] = 0;
 	}
 	discardCardCount = G.discardCount[0];
 	for (i=0; i< discardCardCount;i++){
 		G.discard[0][i] = 1;
 	}
 	
 	if (NOISY_TEST == 1){
 		printf("Expected fullDeckCount: %d + %d + %d = %d\n", handCardCount, deckCardCount, discardCardCount, (handCardCount+deckCardCount+discardCardCount));
 		printf("Actual count from fullDeckCount = %d\n", fullDeckCount(0, copper, &G));
 	}

 //	assert(fullDeckCount(0,1,&G) == (handCardCount+deckCardCount+discardCardCount));
 	
 	fullDeckCount(0, (G.deck[0][0]), &G);
 	return 0;
 }